package com.qhit.dao.imp;

import com.qhit.dao.BaseDao;
import com.qhit.entity.Bank;

import java.util.List;

/**
 * TODO
 *
 * @author 村头老杨头
 * @version 1.0
 * @date 2021/9/29 15:48
 */
public class BankDaoImpl extends BaseDao {
    //查
    public Bank getBankByName(String name){
        String sql = "select * from bank where name=?";
        List list = executeQuery(sql, Bank.class, name);
        if(list!=null && list.size()>0){
            return (Bank) list.get(0);
        }
        return null;
    }
    //修改
    public int updateBank(Bank bank){
        String sql = "update bank set balance=? where name=?";
        return executeUpdate(sql,bank.getBalance(),bank.getName());
    }
}
